package com.cloud.prac.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 邮件发送服务
 *
 * @author 24373
 * @version 1.0
 * @date 2024-04-29 21:39
 */
@RestController
public class MessageController {

    @Autowired
    private JavaMailSender mailSender;

    @GetMapping("/mail")
    private void sendMail() {
        SimpleMailMessage message = new SimpleMailMessage();
        //message.setFrom("antladdie@163.com");
        message.setTo("2437350661@qq.com");
        //message.setCc("xiaofeng500@qq.com");
        //message.setBcc("2437350661@qq.com");
        message.setSubject("test通知");
        message.setText("hello mail！");

        mailSender.send(message);

    }

}
